package easy;

public class Solution_1480 {
    private static int[] nums = {3,1,2,10,1};

    public static void main(String[] args) {
//        int[] runningSum = test1();
        int[] runningSum = test2();


        for (int i : runningSum) {
            System.out.println("i = " + i);
        }
    }

    private static int[] test1() {
        int[] runningSum = new int[nums.length];
        for (int i = 0; i < runningSum.length; i++) {
            if (i == 0) {
                runningSum[i] = nums[i];
            } else {
                runningSum[i] = runningSum[i - 1] + nums[i];
            }
        }
        return runningSum;
    }

    private static int[] test2() {
        int lenth = nums.length;

        for (int i = 1; i < lenth; i++) {
            nums[i] = nums[i - 1] + nums[i];
        }
        return nums;
    }
}
